//
//  UIViewController+HKExtension.h
//  HKProject
//
//  Created by 胡锦涛 on 2018/7/27.
//  Copyright © 2018年 胡锦涛. All rights reserved.
/*
 屏幕旋转使用方法：
 1.AppDelegate写入以下代码
 - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
 UIViewController *rootVC = self.window.rootViewController;
 UIViewController *presentedVC = rootVC.presentedViewController;
 
 if (presentedVC.isBeingDismissed) {
 if ([rootVC respondsToSelector:@selector(hk_supportedInterfaceOrientations)]) {
 return [rootVC hk_supportedInterfaceOrientations];
 }
 }else {
 if ([presentedVC respondsToSelector:@selector(hk_supportedInterfaceOrientations)]) {
 return [presentedVC hk_supportedInterfaceOrientations];
 }
 }
 return UIInterfaceOrientationMaskPortrait;
 }
 2.在视频播放界面设置横屏
 -(UIInterfaceOrientationMask)hk_supportedInterfaceOrientations {
 return UIInterfaceOrientationMaskLandscapeRight;
 }
 */

#import <UIKit/UIKit.h>
@protocol HKOrientationProtocol <NSObject>
@optional
///返回当前ViewController支持的屏幕方向
- (UIInterfaceOrientationMask)hk_supportedInterfaceOrientations;
@end

@interface UIViewController (HKExtension)<HKOrientationProtocol,UINavigationControllerDelegate>

/// 是否隐藏导航栏。默认NO。self.navigationController.delegate = self; 并且hk_hideNavBar  =  YES，避免和页面的Transition动画代理冲突
/// 完美解决navigationBar隐藏/显示
@property (nonatomic , assign) BOOL hk_hideNavBar;

///设置NavBarItem字体颜色
- (void)hk_setNavBarTextColor:(UIColor*)color;

///设置NavBar背景颜色
- (void)hk_setNavBarBgColor:(UIColor*)bgColor;

/// 设置导航条是否半透明
/// @param isTranslucent 导航栏透明后 push界面下移64，解决办法：在不需要透明的VC设置以下代码：self.extendedLayoutIncludesOpaqueBars = YES;
- (void)hk_setNavTranslucent:(BOOL)isTranslucent;

///导航条设置是否隐藏
- (void)hk_setNavBarHidden:(BOOL)isHide;

///状态栏设置是否隐藏
- (void)hk_setStatusBarHidden:(BOOL)isHide;

///状态栏-旋转方向设置
- (void)hk_setStatusBarOrientation:(UIInterfaceOrientation)orientation;

///设置状态栏字体颜色
- (void)hk_setStatusBarTextColor:(UIColor *)color;

///设置状态栏背景颜色
- (void)hk_setStatusBarBackgroundColor:(UIColor *)color;

///避免self.view在nav下面
- (void)hk_adjustNav;

///Present
- (void)hk_present:(UIViewController*)vc;

///返回事件
- (void)hk_back;

///Dismiss
- (void)hk_dismiss;

///回到根视图
- (void)hk_backToRoot;

///设置屏幕旋转方向 UIInterfaceOrientationPortrait
- (void)hk_setOrientation:(UIInterfaceOrientation)orientation;

///竖屏
- (void)hk_portraitScreen;

///横屏
- (void)hk_landscapScreen;

///设置物理设备方向 | UIInterfaceOrientationLandscapeLeft
- (void)hk_changeDeviceOriention:(UIInterfaceOrientation)deviceOriention;

///物理设备方向-竖屏
- (void)hk_devicePortrait;

///物理设备方向-横屏
- (void)hk_deviceLandscap;

///界面跳转动画
- (void)hk_makeTransionWith:(UIViewController*)vc;

///界面跳转平滑过渡
- (void)hk_linearTransionTo:(UIViewController*)destination;

///getPresentedViewController
- (UIViewController *)hk_presentedViewController;

/// 方法交换
+ (void)hk_changeSel:(SEL)sel toSel:(SEL)tosel;

#pragma mark - Alert相关

/// 通用提示Alert:单按钮
- (void)hk_showMessage:(NSString*)message;

///单个按键的 alertView
- (void)hk_alertWithTitle:(NSString *)title
                          message:(NSString *)message
                     confirmTitle:(NSString *)confirmTitle
                  handler:(void(^)(void))handler;

///双按键的 alertView
- (void)hk_alertWithTitle:(NSString *)title
                          message:(NSString *)message
                      cancelTitle:(NSString *)cancelTitle
                     defaultTitle:(NSString *)defaultTitle
                         distinct:(BOOL)distinct
                   cancel:(void(^)(void))cancel confirm:(void(^)(void))confirm;

/// Alert  任意多个按键 返回选中的 buttonIndex 和 buttonTitle
- (void)hk_alertWithTitle:(NSString *)title
                      message:(NSString *)message
                 actionTitles:(NSArray *)actionTitles
               preferredStyle:(UIAlertControllerStyle)preferredStyle
                  handler:(void(^)(NSUInteger buttonIndex, NSString *buttonTitle))handler;

#pragma mark - 系统分享
- (void)hk_systemShareContent:(NSString*)content;
@end


